package com.ikan.positionserver.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
public enum DeviceTypeEnum {
    Switch("switch", "switch", "交换机", 1),
    Server2U("server2U", "server", "2U服务器", 2),
    Server3U("server3U", "server", "3U服务器", 3),
    Server4U("server4U", "server", "4U服务器", 4),


    ;
    //编码
    private String code;
    private String type;
    //描述
    private String desc;
    private int height;

    /***
     * 根据编码来获取枚举值
     * @param code
     * @return
     */
    public static final DeviceTypeEnum getByCode(String code) {
        for (DeviceTypeEnum deviceTypeEnum : values()) {
            if (StringUtils.equalsIgnoreCase(deviceTypeEnum.getCode(), code)) {
                return deviceTypeEnum;
            }
        }
        return null;
    }
}
